# coding=utf-8
# 交易模块下的蓝图，包括交易模块的所有资源
from flask import Blueprint
from flask_restful import Api
from comment.ultils.output import output_json

transaction_bp = Blueprint('transaction', __name__, url_prefix='/transaction')  # 创建蓝图
transaction_api = Api(transaction_bp)  # 创建蓝图中的资源API

# 使用我们自定义json格式，替代装饰器的写法
transaction_api.representation('application/json')(output_json)

# 加载当前模块的资源
from financial.resorces.transaction.invest_resource import Invest_Resource
from financial.resorces.transaction.deal_record_resource import Deal_Resource
from financial.resorces.transaction.loan_resource import LoanApply
from financial.resorces.transaction.debt_resource import Debt
from financial.resorces.transaction.loan_resource import MyLoeanApply
from financial.resorces.transaction.debt_repay_resource import RepayPlan
from financial.resorces.transaction.match_resource import MatchUp
from financial.resorces.transaction.allMatched_resource import AllMatchedResource
from financial.resorces.transaction.matched_result_resource import MatchedResultResource
from financial.resorces.transaction.expectedReturn_resource import ExpectedReturnResource
from financial.resorces.transaction.investincome_resource import InvestIncomeResource

# 加载当前模块的资源
transaction_api.add_resource(Invest_Resource, '/invest_record', endpoint='invest_record')   # 投资记录
transaction_api.add_resource(Deal_Resource, '/deal_record', endpoint='deal_record')  # 交易记录
transaction_api.add_resource(LoanApply, '/loanApply', endpoint='loanApply')  # 借款申请
transaction_api.add_resource(MyLoeanApply, '/myLoan', endpoint='myLoan')  # 我的借款
transaction_api.add_resource(Debt, '/debt', endpoint='debt') # 债权
transaction_api.add_resource(RepayPlan, '/RepayPlan', endpoint='RepayPlan')  # 还款计划
transaction_api.add_resource(Invest_Resource, '/invest', endpoint='invest')  # 投资购买理财产品
transaction_api.add_resource(MatchUp, '/matchUp', endpoint='matchUp')  # 撮合匹配
transaction_api.add_resource(AllMatchedResource, '/fundsNotMatched', endpoint='fundsNotMatched') #所有待匹配资金列表和所有已经匹配资金列表
transaction_api.add_resource(ExpectedReturnResource, '/exceptedReturn', endpoint='exceptedReturn') #预期收益
transaction_api.add_resource(InvestIncomeResource, '/getIncome', endpoint='getIncome') #获得收益
transaction_api.add_resource(MatchedResultResource, '/matchedResult', endpoint='matchedResult') #匹配结果